package com.example.consumer.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.example.consumer.service.OrderService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {



    @Autowired
    private OrderService2 orderService2;

    public String fallback(){
        return "服务忙,请稍后重试!";
    }

    @GetMapping("/port")
    @SentinelResource(value = "port",fallback = "fallback")
    public String port(){
        return orderService2.port();
    }


    @GetMapping("/hello")
    @SentinelResource(value = "hello",fallback = "fallback")
    public String hello(){
        return  "hello Sentinel";
    }
}
